public class demo {
    public static void main(String[] args) {
        Integer[] values ={1, 5, 1, 1, 3, 2, 4};
        Integer[] values2 ={4, 2 ,1 ,5 ,3 ,6, 4};
        Integer[] values3 ={1,2,-1,-2,3,-3,4};
        SeqList<Integer> list = new SeqList<Integer>(values);
        SeqList<Integer> list2 = new SeqList<Integer>(values2);
        SeqList<Integer> list3 = new SeqList<Integer>(values3);
        //存入list
        findminindex(list);

        delete(list2,2,4);
        move(list3);



    }
    public static void findminindex(SeqList<Integer> list){
        int min=0;
        int mini=list.get(0);//设list[0]的元素最小
        for(int j=0;j < list.size();j++){
            if(list.get(j)<=mini){
                mini= list.get(j);
                min=j;
            }
        }
        System.out.println(min);
    }
    public static void delete(SeqList<Integer> list,int x,int y){
        for(int i=0;i< list.size();i++){
            if(list.get(i)>=x && list.get(i)<=y){
                list.remove(i);
                i--;
            }
        }

        System.out.println(list.toString());
    }
    public static void move(SeqList<Integer> list){
        int j = 0, temp;
        for (int i = 0; i < list.size(); i++) {
            if (list.get(i) < 0) {
                if (i != j) {
                    temp = list.get(i);
                    list.set(i, list.get(j));
                    list.set(j,temp);
                }
                j++;

            }
        }
        System.out.println(list.toString());
    }
}
